package com.qf;

import com.qf.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.applet.AppletContext;

public class test {

    @Test
    public void testSpring(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");

        Object userService = applicationContext.getBean("userService");
        System.out.println(userService);

        Object userService1 = applicationContext.getBean("userService");
        System.out.println(userService1);
    }

    @Test
    public void test1(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
//        UserService userService = (UserService) applicationContext.getBean("userService");
//        userService.show();

//        UserService bean = applicationContext.getBean(UserService.class);
//        bean.show();

        UserService userService1 = applicationContext.getBean("userService1", UserService.class);
        userService1.show();

    }
}
